/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package financialcalendar;

import java.util.Date;

/**
 *
 * @author James
 */
public class User {
    public double currentBalance; //stored in data file
    public String firstName;
    public String lastName;
    public int birthDate;
    public int birthMonth;
    public int birthYear;
    public FinancialCalendar myCalendar;
    public String emailAddress;
    public double projectedMonthlyIncome;
    public double projectedDailySpending;
    public double amountSavedThisWeek;
    public double amountSavedThisMonth;
    public double amountSavedToday;
    public double amountSavedLastMonth;
    public double amountSaved2MonthsAgo;
    public int prevMonth;
    
    public static double amountToSaveWeekly; //Calculate these fields: not stored in data file
    public static double amountToSaveDaily;
    public static double amountToSaveMonthly;
    
    public User(double b, String f, String l, int birthMonth, int birthDay, int birthYear, String email, double projMonthInc, double projDaySpend)
    {
        currentBalance = b;
        firstName = f;
        lastName = l;
        birthDate = birthDay;
        this.birthMonth = birthMonth;
        this.birthYear = birthYear;
        emailAddress = email;
        projectedMonthlyIncome = projMonthInc;
        projectedDailySpending = projDaySpend;
        amountSavedLastMonth = 300;
        amountSaved2MonthsAgo = 400;
    }
    public void addCalendar(FinancialCalendar c)
    {
        myCalendar = c;
    }
    public void updateCalendar(double g, GoalType gT, int gD, int gM, int gY)
    {
        myCalendar.goal = g;
        myCalendar.goalDate = gD;
        myCalendar.goalMonth = gM;
        myCalendar.goalYear = gY;
        myCalendar.goalType = gT;
    }
    public String toString()
    {
        int gT;
        if (myCalendar.goalType == GoalType.OTHER)
            gT = 0;
        else if (myCalendar.goalType == GoalType.HOUSE)
            gT = 1;
        else if (myCalendar.goalType == GoalType.BOAT)
            gT = 2;
        else if (myCalendar.goalType == GoalType.VACATION)
            gT = 3;
        else if (myCalendar.goalType == GoalType.LOAN)
            gT = 4;
        else if (myCalendar.goalType == GoalType.FOOD)
            gT = 5;
        else if (myCalendar.goalType == GoalType.NEW_CAR)
            gT = 6;
        else gT = 7;
        //print the user's information in an format that is easy to read from the text field
        return currentBalance + "|" + firstName + "|" + lastName + "|" + birthDate + "|" + birthMonth + "|" + birthYear + "|" + myCalendar.goal + "|" + myCalendar.goalDate + "|" + myCalendar.goalMonth + "|" + myCalendar.goalYear + "|" + gT + "|" + emailAddress + "|" + projectedMonthlyIncome + "|" + projectedDailySpending + "|" + this.amountSavedToday + "|" + this.amountSavedThisWeek + "|" + this.amountSavedThisMonth + "|" + this.amountSavedLastMonth + "|" + this.amountSaved2MonthsAgo + "|" + this.prevMonth;
    }
    public double getBalance()
    {
        return currentBalance;
    }
}
